package com.br.exemploThreadSala;

public class PingPong extends Thread {
	private String palavra;
	private int delay;

	public PingPong(String nome, int delay){
		this.palavra = nome;
		this.delay = delay;
	}


	public void run() {
		try {
			for (;;) {
				System.out.println(palavra);
				Thread.sleep(delay);
			}
		} catch (Exception e) {
			System.err.println("ERRO");
			return;
		}
	}
}
